CC = g++
# CC = icc

VERSION = 0.21

# use this for g++
CFLAGS = -O3   -pipe -mmmx -msse -msse2 -s\
             -fomit-frame-pointer -funroll-all-loops -mieee-fp

# use this for icc
# CFLAGS = -O3 -mcpu=pentium4 -march=pentium4 -axW -xW -tpp7 # -parallel

# Use this for older versions of g++
# CFLAGS = -O3 -march=pentiumpro -pipe -mmmx -msse -s \
# -fomit-frame-pointer -funroll-all-loops 

OUTPUT = TumorAngiogenesis
ARCHIVE_FILE = TumorAngiogenesis_Driver_mingw_code_$(VERSION).zip
ARCHIVE_LIST = *.cpp *.h *.cfg *.xml *.o Makefile* TumorAngiogenesis.cfg \
               TumorAngiogenesis_Driver_ChangeLog.txt 

OBJECTS = ImprovedMath.o Endian.o Matrix.o EasyBMP.o BMPtoMatrix.o \
 band.o DiffusionSolver.o stopwatch.o FileNames.o ParseText.o \
 random.o LogfileEntry.o Plotting.o AngiogenesisInterface.o \
 tissue_types.o driver.o SaveList.o
 
XML_OBJECTS = tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o xml_parser.o 

OBJECTS_OLD = band.o EasyBMP.o BMPtoMatrix.o DiffusionSolver.o \
	Endian.o ImprovedMath.o Matrix.o driver.o \
	ParseText.o random.o stopwatch.o \
	FileNames.o LogfileEntry.o Plotting.o AngiogenesisInterface.o \
	tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o xml_parser.o \
	tissue_types.o
	
TINY_XML_OBJECTS = tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o	  
	
TUMOR_OBJECTS_OLD = TumorGrowthInitialization.o AdvectTumor.o \
	CircularTumorSolutions.o bessel.o NecrosisLevelSets.o \
	Contour.o Curvature.o Polynomial.o DiscreteReinit.o \
	LeastSquares.o reinit.o WENO.o \
	extend.o Gradients.o GaussianFilter.o GaussSeidelMethods.o \
	GhostFluidMethod.o Pressure.o TumorSaveUtilities.o Oxygen.o \
	DiffusionSolverSteadyState.o Microenvironment.o TAF.o 
	
TUMOR_OBJECTS = TumorGrowthInitialization.o DiffusionSolverSteadyState.o Oxygen.o \
 AdvectTumor.o bessel.o Contour.o Curvature.o DiscreteReinit.o extend.o \
 GaussianFilter.o GhostFluidMethod.o Gradients.o LeastSquares.o NecrosisLevelSets.o \
 Polynomial.o reinit.o Pressure.o TAF.o Microenvironment.o TumorSaveUtilities.o \
 WENO.o
    
ANGIO_OBJECTS = myangio.o 
	
all: $(OBJECTS) $(TUMOR_OBJECTS) $(XML_OBJECTS) $(ANGIO_OBJECTS)
	$(CC) $(CFLAGS) -o $(OUTPUT) $(OBJECTS) $(TUMOR_OBJECTS) $(XML_OBJECTS) $(ANGIO_OBJECTS)

$(TUMOR_OBJECTS):
	cp UCI_TumorGrowth/*.o .
	
$(ANGIO_OBJECTS):
	cp Edinburgh_Angio/*.o .
		
AngiogenesisInterface.o: AngiogenesisInterface.cpp
	$(CC) $(CFLAGS) -c AngiogenesisInterface.cpp

FileNames.o: FileNames.cpp
	$(CC) $(CFLAGS) -c FileNames.cpp
	
driver.o: driver.cpp globals.h UCI_TumorGrowth/TumorGrowthIncludes.h
	$(CC) $(CFLAGS) -c driver.cpp
	
stopwatch.o: stopwatch.cpp
	$(CC) $(CFLAGS) -c stopwatch.cpp

band.o: band.cpp
	$(CC) $(CFLAGS) -c band.cpp
	
EasyBMP.o: EasyBMP.cpp
	$(CC) $(CFLAGS) -c EasyBMP.cpp

BMPtoMatrix.o: BMPtoMatrix.cpp
	$(CC) $(CFLAGS) -c BMPtoMatrix.cpp

DiffusionSolver.o: DiffusionSolver.cpp
	$(CC) $(CFLAGS) -c DiffusionSolver.cpp
	
Endian.o: Endian.cpp
	$(CC) $(CFLAGS) -c Endian.cpp
	
ImprovedMath.o: ImprovedMath.cpp
	$(CC) $(CFLAGS) -c ImprovedMath.cpp

Matrix.o: Matrix.cpp
	$(CC) $(CFLAGS) -c Matrix.cpp
	
ParseText.o: ParseText.cpp
	$(CC) $(CFLAGS) -c ParseText.cpp
	
random.o: random.cpp
	$(CC) $(CFLAGS) -c random.cpp
	
LogfileEntry.o: LogfileEntry.cpp
	$(CC) $(CFLAGS) -c LogfileEntry.cpp

Plotting.o: Plotting.cpp
	$(CC) $(CFLAGS) -c Plotting.cpp

tinystr.o: tinystr.cpp
	$(CC) -c $(CFLAGS) tinystr.cpp

tinyxml.o: tinyxml.cpp
	$(CC) -c $(CFLAGS) tinyxml.cpp

tinyxmlerror.o: tinyxmlerror.cpp
	$(CC) -c $(CFLAGS) tinyxmlerror.cpp

tinyxmlparser.o: tinyxmlparser.cpp
	$(CC) -c $(CFLAGS) tinyxmlparser.cpp

xml_parser.o: xml_parser.cpp
	$(CC) -c $(CFLAGS) xml_parser.cpp
	
tissue_types.o: tissue_types.cpp
	$(CC) -c $(CFLAGS) tissue_types.cpp
	
SaveList.o: SaveList.cpp
	$(CC) -c $(CFLAGS) SaveList.cpp
	
archive:
	zip $$(date +%b_%d_%Y_%H%M).zip $(ARCHIVE_LIST)
	zip $(ARCHIVE_FILE) $(ARCHIVE_LIST)

clean: 
	rm -f *.o 
